package com.zito.health.controller;

import com.zito.health.common.annotations.ResponseResult;
import com.zito.health.common.result.VerifyResult;
import com.zito.health.entity.LaboratoryActivity2;
import com.zito.health.entity.LaboratorySystem;
import com.zito.health.service.LaboratorySystemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: 实验室制度表
 * @author: gxt
 * @time: 2019/11/11 11:02
 */
@Slf4j
@ResponseResult
@RestController
@RequestMapping("/laboratorySystem")
public class LaboratorySystemController {

    @Autowired
    private LaboratorySystemService laboratorySystemService;

    @PostMapping
    public VerifyResult save(LaboratorySystem laboratorySystem){
        VerifyResult verifyResult = new VerifyResult();
        if(laboratorySystem.getId()!=null){
            laboratorySystemService.update(laboratorySystem);
        }else {
            laboratorySystemService.save(laboratorySystem);
        }
        return verifyResult;
    }

    @GetMapping
    public List<LaboratorySystem> list(LaboratorySystem laboratorySystem){
        return laboratorySystemService.query(laboratorySystem);
    }

}
